<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,IE=9,chrome=1"><meta name="generator" content="MATLAB 2021a"><title>Visualise conserved moieties in dopaminergic neuronal metabolism</title><style type="text/css">.rtcContent { padding: 30px; } .S0 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 28.8px; min-height: 0px; white-space: pre-wrap; color: rgb(213, 80, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 24px; font-weight: normal; text-align: left;  }
.CodeBlock { background-color: #F7F7F7; margin: 10px 0 10px 0;}
.S1 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 4px 4px 0px 0px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S2 { color: rgb(64, 64, 64); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px;  }
/* Styling that is common to warnings and errors is in diagnosticOutput.css */.embeddedOutputsErrorElement {    min-height: 18px;    max-height: 250px;    overflow: auto;}
.embeddedOutputsErrorElement.inlineElement {}
.embeddedOutputsErrorElement.rightPaneElement {}
/* Styling that is common to warnings and errors is in diagnosticOutput.css */.embeddedOutputsWarningElement{    min-height: 18px;    max-height: 250px;    overflow: auto;}
.embeddedOutputsWarningElement.inlineElement {}
.embeddedOutputsWarningElement.rightPaneElement {}
/* Copyright 2015-2019 The MathWorks, Inc. *//* In this file, styles are not scoped to rtcContainer since they could be in the Dojo Tooltip */.diagnosticMessage-wrapper {    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;    font-size: 12px;}
.diagnosticMessage-wrapper.diagnosticMessage-warningType {    color: rgb(255,100,0);}
.diagnosticMessage-wrapper.diagnosticMessage-warningType a {    color: rgb(255,100,0);    text-decoration: underline;}
.diagnosticMessage-wrapper.diagnosticMessage-errorType {    color: rgb(230,0,0);}
.diagnosticMessage-wrapper.diagnosticMessage-errorType a {    color: rgb(230,0,0);    text-decoration: underline;}
.diagnosticMessage-wrapper .diagnosticMessage-messagePart,.diagnosticMessage-wrapper .diagnosticMessage-causePart {    white-space: pre-wrap;}
.diagnosticMessage-wrapper .diagnosticMessage-stackPart {    white-space: pre;}
.embeddedOutputsTextElement,.embeddedOutputsVariableStringElement {    white-space: pre;    word-wrap:  initial;    min-height: 18px;    max-height: 250px;    overflow: auto;}
.textElement,.rtcDataTipElement .textElement {    padding-top: 3px;}
.embeddedOutputsTextElement.inlineElement,.embeddedOutputsVariableStringElement.inlineElement {}
.inlineElement .textElement {}
.embeddedOutputsTextElement.rightPaneElement,.embeddedOutputsVariableStringElement.rightPaneElement {    min-height: 16px;}
.rightPaneElement .textElement {    padding-top: 2px;    padding-left: 9px;}
.S3 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 0px none rgb(0, 0, 0); border-radius: 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S4 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 0px none rgb(0, 0, 0); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S5 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S6 { margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left;  }
.S7 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 4px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S8 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 0px none rgb(0, 0, 0); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S9 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S10 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 17px; font-weight: bold; text-align: left;  }
.S11 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px 0px 4px 4px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S12 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px; padding: 6px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S13 { margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left;  }
.S14 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;  }</style></head><body><div class = rtcContent><h1  class = 'S0'><span>Visualise conserved moieties in dopaminergic neuronal metabolism</span></h1><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S1'><span style="white-space: pre"><span >tutorial_initConservedMoietyPaths</span></span></div><div  class = 'S2'><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement" uid="DFB2564B" data-testid="output_0" data-width="420" data-height="20" data-hashorizontaloverflow="false" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span class="variableNameElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">modelName = </span>'DAS'</div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement scrollableOutput" uid="6E167826" data-testid="output_1" data-width="420" data-height="20" data-hashorizontaloverflow="true" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span class="variableNameElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">projectDir = </span>'/home/rfleming/work/sbgCloud/code/fork-COBRA.tutorials/analysis/conservedMoieties'</div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement scrollableOutput" uid="BF8D5EF0" data-testid="output_2" data-width="420" data-height="20" data-hashorizontaloverflow="true" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span class="variableNameElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">dataDir = </span>'/home/rfleming/work/sbgCloud/code/fork-COBRA.tutorials/analysis/conservedMoieties/data/models/'</div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement scrollableOutput" uid="840353B8" data-testid="output_3" data-width="420" data-height="20" data-hashorizontaloverflow="true" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span class="variableNameElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">softwareDir = </span>'/home/rfleming/work/sbgCloud/code/fork-COBRA.tutorials/analysis/conservedMoieties/software/'</div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement scrollableOutput" uid="DB453BCA" data-testid="output_4" data-width="420" data-height="20" data-hashorizontaloverflow="true" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span class="variableNameElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">visDataDir = </span>'/home/rfleming/work/sbgCloud/code/fork-COBRA.tutorials/analysis/conservedMoieties/data/visualisation/'</div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement scrollableOutput" uid="BE986FBB" data-testid="output_5" data-width="420" data-height="20" data-hashorizontaloverflow="true" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span class="variableNameElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">resultsDir = </span>'/home/rfleming/work/sbgCloud/code/fork-COBRA.tutorials/analysis/conservedMoieties/results/DAS_ConservedMoieties/'</div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsVariableStringElement scrollableOutput" uid="2B683021" data-testid="output_6" data-width="420" data-height="20" data-hashorizontaloverflow="true" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span class="variableNameElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">rxnfileDir = </span>'/home/rfleming/work/sbgCloud/code/fork-COBRA.tutorials/analysis/conservedMoieties/data/mini-ctf/rxns/atomMapped'</div></div></div></div></div><div class="inlineWrapper"><div  class = 'S3'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">% if ~recompute</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%     load([resultsDir  modelName '_ConservedMoietiesAnalysis.mat'])</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%     return</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">% end</span></span></div></div></div><div  class = 'S6'><span>Load the dopaminergic neuronal metabolic model</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span >load([dataDir modelName </span><span style="color: rgb(170, 4, 249);">'.mat'</span><span >])</span></span></div></div></div><div  class = 'S6'><span>Identify the stoichiometrically consistent subset of the model</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >massBalanceCheck=1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >printLevel=1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >[SConsistentMetBool, SConsistentRxnBool, SInConsistentMetBool, SInConsistentRxnBool, unknownSConsistencyMetBool, unknownSConsistencyRxnBool, model]</span><span style="color: rgb(14, 0, 255);">...</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S9'><span style="white-space: pre"><span >    = findStoichConsistentSubset(model,massBalanceCheck,printLevel);</span></span></div><div  class = 'S2'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement scrollableOutput" uid="D65AA881" data-testid="output_7" data-width="420" data-height="199" data-hashorizontaloverflow="true" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">--- findStoichConsistentSubset START ----
--- Summary of stoichiometric consistency ----
    11	    11	 totals.
     0	     7	 heuristically external.
    11	     4	 heuristically internal:
    11	     4	 ... of which are stoichiometrically consistent.
     0	     0	 ... of which are stoichiometrically inconsistent.
     0	     0	 ... of which are of unknown consistency.
---
     0	     0	 heuristically internal and stoichiometrically inconsistent or unknown consistency.
     0	     0	 ... of which are elementally imbalanced (inclusively involved metabolite).
     0	     0	 ... of which are elementally imbalanced (exclusively involved metabolite).
    11	     4	 Confirmed stoichiometrically consistent by leak/siphon testing.
--- findStoichConsistentSubset END ----</div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="8F59FAB4" data-testid="output_8" data-width="420" data-height="30" data-hashorizontaloverflow="false" style="width: 450px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: pre-wrap; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: Model did not contain a genes field. Building it along with the rules field</div><div class="diagnosticMessage-stackPart" style="white-space: pre; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div><div class="inlineElement eoOutputWrapper embeddedOutputsWarningElement" uid="9D9B58D3" data-testid="output_9" data-width="420" data-height="30" data-hashorizontaloverflow="false" style="width: 450px; max-height: 261px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="diagnosticMessage-wrapper diagnosticMessage-warningType" style="white-space: normal; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"><div class="diagnosticMessage-messagePart" style="white-space: pre-wrap; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;">Warning: This function can be only be used on a model that has grRules field!\n</div><div class="diagnosticMessage-stackPart" style="white-space: pre; font-style: normal; color: rgb(255, 100, 0); font-size: 12px;"></div></div></div></div></div></div><h3  class = 'S10'><span>Metabolite connectity</span></h3><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >param.n=20;</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S9'><span style="white-space: pre"><span >[rankMetConnectivity,rankMetInd,rankConnectivity] = rankMetabolicConnectivity(model,param);</span></span></div><div  class = 'S2'><div class="inlineElement eoOutputWrapper embeddedOutputsFigure" uid="8B3AE232" data-testid="output_10" style="width: 450px;"><div class="figureElement"><img class="figureImage figureContainingNode" src="" style="width: 560px;"></div></div></div></div></div><h3  class = 'S10'><span>Load atomically resolved models &amp; conserved moiety analysis</span></h3><div  class = 'S6'><span>Load the atomically resolved models derived from identifyConservedMoieties.m</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">if </span><span >0</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    load([resultsDir </span><span style="color: rgb(170, 4, 249);">'iDopaMoieties_noChecks.mat'</span><span >])</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">else</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    load([resultsDir  modelName </span><span style="color: rgb(170, 4, 249);">'_ConservedMoietiesAnalysis.mat'</span><span >])</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div><h3  class = 'S10'><span>Transitive moiety, of sufficient mass, with moderate incidence</span></h3><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >isTransititiveMoiety= strcmp(</span><span style="color: rgb(170, 4, 249);">'Transitive'</span><span >,moietyTypes);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >isModerateIncidence = moietyIncidence&gt;=10 &amp; moietyIncidence&lt;=100;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >isSufficientMass = moietyMasses &gt; 2;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >isSufficientMinimalMassFraction = minimalMassFraction &gt; 0.1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >interestingMoiety = isTransititiveMoiety &amp; isModerateIncidence &amp; isSufficientMass &amp; isSufficientMinimalMassFraction;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >C = cell(nnz(interestingMoiety),9);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >n=1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">for </span><span >i=1:size(arm.L,1)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    </span><span style="color: rgb(14, 0, 255);">if </span><span >interestingMoiety(i)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        ind = find(strcmp(minimalMassMetabolite{i},model.mets));</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        C(n,1:9) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),minimalMassMetabolite{i},model.metNames{ind},model.metFormulas{ind},minimalMassFraction(i)};</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        n=n+1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >C=sortrows(C,9,</span><span style="color: rgb(170, 4, 249);">'descend'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >T=cell2table(C);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >T.Properties.VariableNames={</span><span style="color: rgb(170, 4, 249);">'index'</span><span >,</span><span style="color: rgb(170, 4, 249);">'metabolites'</span><span >,</span><span style="color: rgb(170, 4, 249);">'rxns'</span><span >,</span><span style="color: rgb(170, 4, 249);">'moiety_formula'</span><span >,</span><span style="color: rgb(170, 4, 249);">'mass'</span><span >,</span><span style="color: rgb(170, 4, 249);">'Minimal_mass_metabolite'</span><span >,</span><span style="color: rgb(170, 4, 249);">'Name'</span><span >,</span><span style="color: rgb(170, 4, 249);">'Formula'</span><span >,</span><span style="color: rgb(170, 4, 249);">'Mass_fraction'</span><span >};</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S9'><span style="white-space: pre"><span >size(T,1)</span></span></div><div  class = 'S2'><div class='variableElement' style='font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12px; '>ans = 0</div></div></div><div class="inlineWrapper"><div  class = 'S11'><span style="white-space: pre"><span >disp(T)</span></span></div></div></div><h3  class = 'S10'><span>Recon3Map</span></h3><div  class = 'S6'><span>Import Recon3Map</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">if </span><span >~exist(</span><span style="color: rgb(170, 4, 249);">'Recon3xml'</span><span >,</span><span style="color: rgb(170, 4, 249);">'var'</span><span >)   </span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    [Recon3xml, Recon3map] = transformXML2Map([visDataDir </span><span style="color: rgb(170, 4, 249);">'reconMap3d_allin.xml'</span><span >]);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">if </span><span >0</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    transformMap2XML(Recon3xml,Recon3map,[resultsDir </span><span style="color: rgb(170, 4, 249);">'Recon3map.xml'</span><span >]);</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div><h3  class = 'S10'><span>Compare the reactions in the specified metabolic model and Recon3Map</span></h3><div  class = 'S6'><span>The function </span><span style=' font-family: monospace;'>checkCDerrors</span><span> gives four outputs summarising all possible discrepancies between model and map.</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >printLevel=0;</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span >[diffReactions, diffMetabolites, diffReversibility, diffFormula] = checkCDerrors(Recon3map, model,printLevel);</span></span></div></div></div><div  class = 'S6'><span>Four outputs are obtained from this function:</span></div><div  class = 'S6'><span>"</span><span style=' font-family: monospace;'>diffReactions</span><span>" summarises present and absent reactions between model and map.</span></div><div  class = 'S6'><span>Display the internal reactions in the model that are not present in the map.</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >bool=ismember(diffReactions.extraRxnModel,model.rxns(model.SConsistentRxnBool));</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S9'><span style="white-space: pre"><span >nnz(bool)</span></span></div><div  class = 'S2'><div class='variableElement' style='font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12px; '>ans = 4</div></div></div><div class="inlineWrapper outputs"><div  class = 'S12'><span style="white-space: pre"><span >disp(diffReactions.extraRxnModel(bool))</span></span></div><div  class = 'S2'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="0304668E" data-testid="output_13" data-width="420" data-height="59" data-hashorizontaloverflow="false" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">    {'R1'}
    {'R2'}
    {'R3'}
    {'R4'}</div></div></div></div></div><div  class = 'S13'><span>"</span><span style=' font-family: monospace;'>diffMetabolites</span><span>" summarises present and absent metabolites. </span></div><div  class = 'S6'><span style=' font-weight: bold; font-style: italic;'>NOTE!</span><span style=' font-style: italic;'> Note that having more metabolites and reactions in the COBRA model is normal since the model can contain more elements than the map. On the other hand, the map should only contain elements present in the model.</span></div><div  class = 'S6'><span> "</span><span style=' font-family: monospace;'>diffReversibility</span><span>" summarises discrepancies in defining the reversibility of reactions.</span></div><div  class = 'S6'><span>The last output "</span><span style=' font-family: monospace;'>diffFormula"</span><span> summarises discrepancies in reactions formulae (kinetic rates) and also lists duplicated reactions.</span></div><h3  class = 'S10'><span>Create a map of the model</span></h3><div  class = 'S6'><span>Remove some reactions from the map</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span >rxnRemoveList = diffReactions.extraRxnsMap;</span></span></div></div></div><div  class = 'S13'><span>Remove non-dopaminergic neuronal reactions from the map</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span >[modelNameXml,modelNameMap] = removeMapReactions(Recon3xml, Recon3map,rxnRemoveList);</span></span></div></div></div><div  class = 'S13'><span>Remove pathway labels from the map</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >specRemoveType=</span><span style="color: rgb(170, 4, 249);">'UNKNOWN'</span><span >;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >specRemoveList=[];</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >printLevel=0;</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span >[modelNameXml,modelNameMap,specNotInMap] = removeMapSpecies(modelNameXml,modelNameMap,specRemoveList,specRemoveType,printLevel);</span></span></div></div></div><div  class = 'S6'><span>Remove highly connected metabolites from the map</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >specRemoveList={</span><span style="color: rgb(170, 4, 249);">'h[c]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'h[l]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'h[e]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'h[r]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'h2o[c]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'h2o[l]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'h20[e]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'pi[c]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'adp[c]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'nadph[c]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'nadh[c]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'nadph[m]'</span><span >;</span><span style="color: rgb(170, 4, 249);">'nadh[m]'</span><span >};</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span >[xmlStruct,map,specNotInMap] = removeMapSpeciesOnly(modelNameXml,modelNameMap,specRemoveList,specRemoveType,printLevel);</span></span></div></div></div><div  class = 'S6'><span>Export the model map</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S1'><span style="white-space: pre"><span >transformMap2XML(modelNameXml,modelNameMap,[resultsDir modelName </span><span style="color: rgb(170, 4, 249);">'_CD.xml'</span><span >]);</span></span></div><div  class = 'S2'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="336E83F9" data-testid="output_14" data-width="420" data-height="18" data-hashorizontaloverflow="false" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">Elapsed time is 0.030606 seconds.</div></div></div></div></div><h3  class = 'S10'><span>Nicotinate moiety</span></h3><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >ind = 9;</span><span style="color: rgb(2, 128, 9);">% Nicotinate moiety</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >mBool=arm.L(min(ind,size(arm.L,1)),:)~=0;</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S9'><span style="white-space: pre"><span >nnz(mBool)</span></span></div><div  class = 'S2'><div class='variableElement' style='font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12px; '>ans = 5</div></div></div><div class="inlineWrapper"><div  class = 'S3'><span style="white-space: pre"><span >rBool = getCorrespondingCols(model.S, mBool, true(size(model.S,2),1), </span><span style="color: rgb(170, 4, 249);">'inclusive'</span><span >);</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S9'><span style="white-space: pre"><span >nnz(rBool)</span></span></div><div  class = 'S2'><div class='variableElement' style='font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12px; '>ans = 6</div></div></div></div><div  class = 'S13'><span>Metabolites</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >bool=mBool;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >C = cell(nnz(bool),5);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >n=1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">for </span><span >i=1:size(model.S,1)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    </span><span style="color: rgb(14, 0, 255);">if </span><span >bool(i)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        C(n,1:5) = {i,model.mets{i},model.metNames{i},model.metFormulas{i},metMasses(i)};</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        n=n+1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >C=sortrows(C,5,</span><span style="color: rgb(170, 4, 249);">'descend'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >T=cell2table(C);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >T.Properties.VariableNames={</span><span style="color: rgb(170, 4, 249);">'index'</span><span >,</span><span style="color: rgb(170, 4, 249);">'met'</span><span >,</span><span style="color: rgb(170, 4, 249);">'name'</span><span >,</span><span style="color: rgb(170, 4, 249);">'formula'</span><span >,</span><span style="color: rgb(170, 4, 249);">'mass'</span><span >};</span></span></div></div><div class="inlineWrapper outputs"><div  class = 'S9'><span style="white-space: pre"><span >disp(T)</span></span></div><div  class = 'S2'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement scrollableOutput" uid="4D303E38" data-testid="output_17" data-width="420" data-height="115" data-hashorizontaloverflow="true" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">    <strong style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">index</strong>        <strong style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">met</strong>           <strong style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">name</strong>          <strong style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">formula</strong>        <strong style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">mass</strong> 
    <strong style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">_____</strong>    <strong style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">___________</strong>    <strong style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">___________</strong>    <strong style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">____________</strong>    <strong style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">______</strong>

      7      {'34dhphe'}    {'34dhphe'}    {'C9H11NO4'}    197.07
      4      {'tyr_L'  }    {'tyr_L'  }    {'C9H11NO3'}    181.07
      9      {'dopa'   }    {'dopa'   }    {'C8H12NO2'}    154.09
      3      {'o2'     }    {'o2'     }    {'O2'      }     31.99
      6      {'h2o'    }    {'h2o'    }    {'H2O'     }    18.011</div></div></div></div></div><div  class = 'S13'><span>Reactions</span></div><div class="CodeBlock"><div class="inlineWrapper outputs"><div  class = 'S1'><span style="white-space: pre"><span >formulas = printRxnFormula(model, model.rxns(rBool));</span></span></div><div  class = 'S2'><div class="inlineElement eoOutputWrapper embeddedOutputsTextElement" uid="17ED37C3" data-testid="output_18" data-width="420" data-height="87" data-hashorizontaloverflow="false" style="width: 450px; max-height: 261px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="textElement" style="white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">R1	phe_L + thbpt + o2 	-&gt;	tyr_L + dhbpt + h2o 
R2	thbpt + o2 + tyr_L 	-&gt;	dhbpt + h2o + 34dhphe 
R3	34dhphe + h 	-&gt;	dopa + co2 
EX_o2	o2 	&lt;=&gt;	
EX_h2o	h2o 	-&gt;	
EX_dopa	dopa 	-&gt;	</div></div></div></div></div><h3  class = 'S10'><span>Map of nicotinate subnetwork</span></h3><div  class = 'S6'><span>This code is specific to the dopaminergic neuronal metabolic model. Export the dopaminergic neuronal model as an sbml file</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">if </span><span >0</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    nicotinateRxnRemoveList=model.rxns(~rBool);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    [iDopaNicotinateXml,iDopaNicotinateMap] = removeMapReactions(iDopaXml,iDopaMap,nicotinateRxnRemoveList);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    transformMap2XML(iDopaNicotinateXml,iDopaNicotinateMap,[resultsDir modelName </span><span style="color: rgb(170, 4, 249);">'_Nicotinate_CD.xml'</span><span >]);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    outmodel = writeCbModel(model, </span><span style="color: rgb(170, 4, 249);">'format'</span><span >,</span><span style="color: rgb(170, 4, 249);">'sbml'</span><span >,</span><span style="color: rgb(170, 4, 249);">'fileName'</span><span >, [resultsDir </span><span style="color: rgb(170, 4, 249);">'iDopaNeuro_SBML.xml'</span><span >]);</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div><h2  class = 'S14'><span>Generate a set of submodels of the interesting moieties</span></h2><div  class = 'S6'><span>Get abbreviations, without compartments for each metabolite in the model, then generate a results directory for each interesting moiety</span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >[compartments, uniqueCompartments, minimalMassMetaboliteAbbr, uniqueAbbr]= getCompartment(minimalMassMetabolite);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >extractSubnetwork=1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >matFile=0;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >sbmlFile=1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >moietyData=1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >CDFile=0;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >n=1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">for </span><span >i=1:size(arm.L,1)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    </span><span style="color: rgb(14, 0, 255);">if </span><span >interestingMoiety(i)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        metSampleName = minimalMassMetaboliteAbbr{i};</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        disp(metSampleName)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        [SUCCESS,MESSAGE,MESSAGEID] = mkdir(resultsDir,metSampleName);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        cd([resultsDir filesep metSampleName])</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        mBool = arm.L(i,:)~=0;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        rBool = getCorrespondingCols(model.S, mBool, true(size(model.S,2),1), </span><span style="color: rgb(170, 4, 249);">'inclusive'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span><span style="color: rgb(14, 0, 255);">if </span><span >extractSubnetwork</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            modelNameInterestingSubModel{n,1} = extractSubNetwork(model, model.rxns(rBool), model.mets(mBool), 1);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        mBoolModel = ismember(model.mets,modelNameInterestingSubModel{n,1}.mets);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        modelNameInterestingSubModel{n,2}=i;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        modelNameInterestingSubModel{n,3}=minimalMassMetabolite{i};</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span><span style="color: rgb(14, 0, 255);">if </span><span >matFile</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            outmodel = writeCbModel(modelNameInterestingSubModel{n,1}, </span><span style="color: rgb(170, 4, 249);">'format'</span><span >,</span><span style="color: rgb(170, 4, 249);">'mat'</span><span >,</span><span style="color: rgb(170, 4, 249);">'fileName'</span><span >, [resultsDir metSampleName filesep modelName </span><span style="color: rgb(170, 4, 249);">'_' </span><span >metSampleName </span><span style="color: rgb(170, 4, 249);">'.mat'</span><span >]);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >                </span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span><span style="color: rgb(14, 0, 255);">if </span><span >sbmlFile</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            outmodel = writeCbModel(modelNameInterestingSubModel{n,1}, </span><span style="color: rgb(170, 4, 249);">'format'</span><span >,</span><span style="color: rgb(170, 4, 249);">'sbml'</span><span >,</span><span style="color: rgb(170, 4, 249);">'fileName'</span><span >, [resultsDir metSampleName filesep modelName </span><span style="color: rgb(170, 4, 249);">'_' </span><span >metSampleName </span><span style="color: rgb(170, 4, 249);">'_SBML.xml'</span><span >]);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span><span style="color: rgb(14, 0, 255);">if </span><span >moietyData</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            </span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            moietyIncidence = arm.L(modelNameInterestingSubModel{n,2},ismember(model.mets,modelNameInterestingSubModel{n,1}.mets))';</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            </span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            fileName = [resultsDir metSampleName filesep modelName </span><span style="color: rgb(170, 4, 249);">'_' </span><span >metSampleName </span><span style="color: rgb(170, 4, 249);">'_moietyData.txt'</span><span >];</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            param.name = [modelName </span><span style="color: rgb(170, 4, 249);">'_' </span><span >metSampleName </span><span style="color: rgb(170, 4, 249);">'MoietySubnetwork'</span><span >];</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            param.description = [modelName </span><span style="color: rgb(170, 4, 249);">'_' </span><span >metSampleName </span><span style="color: rgb(170, 4, 249);">' moiety incidence'</span><span >];</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            param.color.minValue = -1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            param.color.minColor = </span><span style="color: rgb(170, 4, 249);">'#FF0000'</span><span >;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            param.color.zeroValue = 0;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            param.color.zeroColor = </span><span style="color: rgb(170, 4, 249);">'#FFFFFF'</span><span >;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            param.color.maxValue =  full(max(moietyIncidence));</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            param.color.maxColor = </span><span style="color: rgb(170, 4, 249);">'#87CEFA'</span><span >;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            writeNewtExperiment(modelNameInterestingSubModel{n,1},moietyIncidence,metSampleName,fileName,param);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span><span style="color: rgb(14, 0, 255);">if </span><span >CDFile</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            [modelNameInterestingXml{n},modelNameInterestingMap{n},modelNameRxnNotInMap{n}] = removeMapReactions(modelNameXml,modelNameMap,model.rxns(~rBool));</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >            transformMap2XML(modelNameInterestingXml{n},modelNameInterestingMap{n},[resultsDir metSampleName filesep modelName </span><span style="color: rgb(170, 4, 249);">'_' </span><span >metSampleName </span><span style="color: rgb(170, 4, 249);">'_CD.xml'</span><span >]);</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        n=n+1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >        cd(</span><span style="color: rgb(170, 4, 249);">'../'</span><span >)</span></span></div></div><div class="inlineWrapper"><div  class = 'S4'><span style="white-space: pre"><span >    </span><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S5'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div><div  class = 'S13'></div>
<br>
<!-- 
##### SOURCE BEGIN #####
%% Visualise conserved moieties in dopaminergic neuronal metabolism

tutorial_initConservedMoietyPaths
% if ~recompute
%     load([resultsDir  modelName '_ConservedMoietiesAnalysis.mat'])
%     return
% end
%% 
% Load the dopaminergic neuronal metabolic model

load([dataDir modelName '.mat'])
%% 
% Identify the stoichiometrically consistent subset of the model

massBalanceCheck=1;
printLevel=1;
[SConsistentMetBool, SConsistentRxnBool, SInConsistentMetBool, SInConsistentRxnBool, unknownSConsistencyMetBool, unknownSConsistencyRxnBool, model]...
    = findStoichConsistentSubset(model,massBalanceCheck,printLevel);
% Metabolite connectity

param.n=20;
[rankMetConnectivity,rankMetInd,rankConnectivity] = rankMetabolicConnectivity(model,param);
% Load atomically resolved models & conserved moiety analysis
% Load the atomically resolved models derived from identifyConservedMoieties.m

if 0
    load([resultsDir 'iDopaMoieties_noChecks.mat'])
else
    load([resultsDir  modelName '_ConservedMoietiesAnalysis.mat'])
end
% Transitive moiety, of sufficient mass, with moderate incidence

isTransititiveMoiety= strcmp('Transitive',moietyTypes);
isModerateIncidence = moietyIncidence>=10 & moietyIncidence<=100;
isSufficientMass = moietyMasses > 2;
isSufficientMinimalMassFraction = minimalMassFraction > 0.1;
interestingMoiety = isTransititiveMoiety & isModerateIncidence & isSufficientMass & isSufficientMinimalMassFraction;
C = cell(nnz(interestingMoiety),9);
n=1;
for i=1:size(arm.L,1)
    if interestingMoiety(i)
        ind = find(strcmp(minimalMassMetabolite{i},model.mets));
        C(n,1:9) = {i,nnz(arm.L(i,:)),nnz(model.S((arm.L(i,:)~=0)',:)~=0),moietyFormulae{i},moietyMasses(i),minimalMassMetabolite{i},model.metNames{ind},model.metFormulas{ind},minimalMassFraction(i)};
        n=n+1;
    end
end

C=sortrows(C,9,'descend');
T=cell2table(C);
T.Properties.VariableNames={'index','metabolites','rxns','moiety_formula','mass','Minimal_mass_metabolite','Name','Formula','Mass_fraction'};
size(T,1)
disp(T)
% Recon3Map
% Import Recon3Map

if ~exist('Recon3xml','var')   
    [Recon3xml, Recon3map] = transformXML2Map([visDataDir 'reconMap3d_allin.xml']);
end
if 0
    transformMap2XML(Recon3xml,Recon3map,[resultsDir 'Recon3map.xml']);
end
% Compare the reactions in the specified metabolic model and Recon3Map
% The function |checkCDerrors| gives four outputs summarising all possible discrepancies 
% between model and map.

printLevel=0;
[diffReactions, diffMetabolites, diffReversibility, diffFormula] = checkCDerrors(Recon3map, model,printLevel);
%% 
% Four outputs are obtained from this function:
% 
% "|diffReactions|" summarises present and absent reactions between model and 
% map.
% 
% Display the internal reactions in the model that are not present in the map.

bool=ismember(diffReactions.extraRxnModel,model.rxns(model.SConsistentRxnBool));
nnz(bool)
disp(diffReactions.extraRxnModel(bool))
%% 
% "|diffMetabolites|" summarises present and absent metabolites. 
% 
% _*NOTE!* Note that having more metabolites and reactions in the COBRA model 
% is normal since the model can contain more elements than the map. On the other 
% hand, the map should only contain elements present in the model._
% 
% "|diffReversibility|" summarises discrepancies in defining the reversibility 
% of reactions.
% 
% The last output "|diffFormula"| summarises discrepancies in reactions formulae 
% (kinetic rates) and also lists duplicated reactions.
% Create a map of the model
% Remove some reactions from the map

rxnRemoveList = diffReactions.extraRxnsMap;
%% 
% Remove non-dopaminergic neuronal reactions from the map

[modelNameXml,modelNameMap] = removeMapReactions(Recon3xml, Recon3map,rxnRemoveList);
%% 
% Remove pathway labels from the map

specRemoveType='UNKNOWN';
specRemoveList=[];
printLevel=0;
[modelNameXml,modelNameMap,specNotInMap] = removeMapSpecies(modelNameXml,modelNameMap,specRemoveList,specRemoveType,printLevel);
%% 
% Remove highly connected metabolites from the map

specRemoveList={'h[c]';'h[l]';'h[e]';'h[r]';'h2o[c]';'h2o[l]';'h20[e]';'pi[c]';'adp[c]';'nadph[c]';'nadh[c]';'nadph[m]';'nadh[m]'};
[xmlStruct,map,specNotInMap] = removeMapSpeciesOnly(modelNameXml,modelNameMap,specRemoveList,specRemoveType,printLevel);
%% 
% Export the model map

transformMap2XML(modelNameXml,modelNameMap,[resultsDir modelName '_CD.xml']);
% Nicotinate moiety

ind = 9;% Nicotinate moiety
mBool=arm.L(min(ind,size(arm.L,1)),:)~=0;
nnz(mBool)
rBool = getCorrespondingCols(model.S, mBool, true(size(model.S,2),1), 'inclusive');
nnz(rBool)
%% 
% Metabolites

bool=mBool;
C = cell(nnz(bool),5);
n=1;
for i=1:size(model.S,1)
    if bool(i)
        C(n,1:5) = {i,model.mets{i},model.metNames{i},model.metFormulas{i},metMasses(i)};
        n=n+1;
    end
end
C=sortrows(C,5,'descend');
T=cell2table(C);
T.Properties.VariableNames={'index','met','name','formula','mass'};
disp(T)
%% 
% Reactions

formulas = printRxnFormula(model, model.rxns(rBool));
% Map of nicotinate subnetwork
% This code is specific to the dopaminergic neuronal metabolic model. Export 
% the dopaminergic neuronal model as an sbml file

if 0
    nicotinateRxnRemoveList=model.rxns(~rBool);
    [iDopaNicotinateXml,iDopaNicotinateMap] = removeMapReactions(iDopaXml,iDopaMap,nicotinateRxnRemoveList);
    transformMap2XML(iDopaNicotinateXml,iDopaNicotinateMap,[resultsDir modelName '_Nicotinate_CD.xml']);
    outmodel = writeCbModel(model, 'format','sbml','fileName', [resultsDir 'iDopaNeuro_SBML.xml']);
end
%% Generate a set of submodels of the interesting moieties
% Get abbreviations, without compartments for each metabolite in the model, 
% then generate a results directory for each interesting moiety

[compartments, uniqueCompartments, minimalMassMetaboliteAbbr, uniqueAbbr]= getCompartment(minimalMassMetabolite);
extractSubnetwork=1;
matFile=0;
sbmlFile=1;
moietyData=1;
CDFile=0;
n=1;
for i=1:size(arm.L,1)
    if interestingMoiety(i)
        metSampleName = minimalMassMetaboliteAbbr{i};
        disp(metSampleName)
        [SUCCESS,MESSAGE,MESSAGEID] = mkdir(resultsDir,metSampleName);
        cd([resultsDir filesep metSampleName])
        mBool = arm.L(i,:)~=0;
        rBool = getCorrespondingCols(model.S, mBool, true(size(model.S,2),1), 'inclusive');
        if extractSubnetwork
            modelNameInterestingSubModel{n,1} = extractSubNetwork(model, model.rxns(rBool), model.mets(mBool), 1);
        end
        mBoolModel = ismember(model.mets,modelNameInterestingSubModel{n,1}.mets);
        modelNameInterestingSubModel{n,2}=i;
        modelNameInterestingSubModel{n,3}=minimalMassMetabolite{i};
        
        if matFile
            outmodel = writeCbModel(modelNameInterestingSubModel{n,1}, 'format','mat','fileName', [resultsDir metSampleName filesep modelName '_' metSampleName '.mat']);
        end
                
        if sbmlFile
            outmodel = writeCbModel(modelNameInterestingSubModel{n,1}, 'format','sbml','fileName', [resultsDir metSampleName filesep modelName '_' metSampleName '_SBML.xml']);
        end
        
        if moietyData
            
            moietyIncidence = arm.L(modelNameInterestingSubModel{n,2},ismember(model.mets,modelNameInterestingSubModel{n,1}.mets))';
            
            fileName = [resultsDir metSampleName filesep modelName '_' metSampleName '_moietyData.txt'];
            param.name = [modelName '_' metSampleName 'MoietySubnetwork'];
            param.description = [modelName '_' metSampleName ' moiety incidence'];
            param.color.minValue = -1;
            param.color.minColor = '#FF0000';
            param.color.zeroValue = 0;
            param.color.zeroColor = '#FFFFFF';
            param.color.maxValue =  full(max(moietyIncidence));
            param.color.maxColor = '#87CEFA';
            writeNewtExperiment(modelNameInterestingSubModel{n,1},moietyIncidence,metSampleName,fileName,param);
        end
        
        if CDFile
            [modelNameInterestingXml{n},modelNameInterestingMap{n},modelNameRxnNotInMap{n}] = removeMapReactions(modelNameXml,modelNameMap,model.rxns(~rBool));
            transformMap2XML(modelNameInterestingXml{n},modelNameInterestingMap{n},[resultsDir metSampleName filesep modelName '_' metSampleName '_CD.xml']);
        end
        n=n+1;
        cd('../')
    end
end
%% 
%
##### SOURCE END #####
-->
</div></body></html>